package com.yc.forum.servlet;

import com.yc.forum.dao.UserDao;
import com.yc.forum.util.Utils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

//查询用户信息
@WebServlet(name = "QueryUserServlet", value = "/QueryUser.s")
public class QueryUserServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        UserDao userDao=new UserDao();
        HttpSession session=request.getSession();
        String name=session.getAttribute("loginedUser").toString();
        //        点进别人账号主页
        String account=request.getParameter("account");
        System.out.println("account============"+account);
        if(account!=null){
            name=account;
        }
        Map<String,Object> map=userDao.queryUserMessagesByAccount(name);
        Utils.toJson(map,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
